#include<16f877a.h>
//#device ADC=10
#include<stdlib.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=11592000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#use i2c(Master,sda=PIN_C4,scl=PIN_C3)
#include "slave.c"
//#include "master.h"

byte data = 0;
#int_TIMER0
void  TIMER0_isr(void)
{
	printf("I'm sending this on I2C: %d \r\n", data);
	i2c_start ();
        i2c_write (0xA0);
        i2c_write (data);
        i2c_stop ();
	data++;
}

void main()
{
   printf("MASTER!\r\n");
   setup_adc_ports(AN0_AN1_AN3);
   setup_adc(ADC_CLOCK_INTERNAL);
   setup_psp(PSP_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_TIMER0);
   enable_interrupts(GLOBAL);

   while(1){}
}
